
class EssayForm extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            value: '请撰写文章'
        }
        this.handleChange = this.handleChange.bind(this)
        this.handleSubmit = this.handleSubmit.bind(this)
    }
    handleChange(event) {
        this.setState({ value: event.target.value })
    }
    handleSubmit(event) {
        alert('提交的文章：' + this.state.value)
        event.preventDefault();
    }
    render() {
        return (
            <form onSubmit={this.handleSubmit}>
                <label>
                    文章：
                    <textarea value={this.state.value} onChange={this.handleChange}></textarea>
                </label>
                <input type="file" multipl></input>
                <select>
                    <option value="grapefruit">葡萄柚</option>
                    <option value="lime">酸橙</option>
                    <option selected value="coconut">椰子</option>
                    <option value="mango">芒果</option>
                </select>
                <input type="submit" value="提交"></input>
            </form>
        )
    }
}
ReactDOM.render(
    <EssayForm />,
    document.getElementById('root2')
)